package org.hcyspartnoc.demo.mapper.system;

import cn.hutool.db.Page;
import com.github.yulichang.base.MPJBaseMapper;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.hcyspartnoc.demo.pojo.po.system.SysUserPo;
import org.hcyspartnoc.demo.pojo.vo.system.SysUserVo;

import java.util.List;

@Mapper
public interface SysUserMapper extends MPJBaseMapper<SysUserPo> {
    SysUserPo selectUserById(Integer userId);

    @Insert("insert into sys_role_user (role_id, user_id) values (#{roleId},#{id})")
    void addRoleid(Integer roleId, Integer id);

    @Delete("delete from sys_role_user where user_id=#{id}")
    void deleteallrole(Integer id);

    @Select("select id from sys_user where account=#{account}")
    Integer selectUserByaccount(String account);


    @Delete("delete from sys_user where id=#{user}")
    void removeuserByid(Integer user);

    @Delete("delete from sys_role_user where user_id=#{user}")
    void removeuserandrole(Integer user);

    //Page<SysUserVo> pageQuery(String nickName, String account, List<Integer> roleIds, String sortField, String sortOrder);
}
